/*
** builtins.c for 42sh in /home/demesy_j/svn/quarante-deuxsh/trunk
** 
** Made by julien demesy
** Login   <demesy_j@epitech.net>
** 
** Started on  Mon Mar 12 16:45:24 2012 julien demesy
** Last update Sun Mar 18 17:33:06 2012 julien demesy
*/

#include	<unistd.h>
#include	<stdlib.h>
#include	<stdio.h>
#include	<errno.h>
#include	<string.h>
#include	"builtins.h"

void	        my_cd(t_list *env, char *path)
{
  if (chdir(path) == -1)
    {
      puts(strerror(errno));
    }
  else
    {
      /* my_unsetenv(env, "OLDPWD"); */
      /* my_setenv(env, strcat(strdup("OLDPWD="), my_getenv("PWD"))); */
      my_unsetenv(env, "PWD");
      my_setenv(env, strcat(strdup("PWD="), get_current_dir_name()));
    }
}

void		my_exit(int status)
{
  puts("exit");
  exit(status);
}
